package com.cirkana.viewer.route;

import java.io.DataInputStream;
import java.io.DataOutputStream;

import com.cirkana.serial.SerializablePassData;
import com.cirkana.serial.SerializationException;
import com.cirkana.viewer.route.model.gpx.Tracker;

public class RouteDetailPassData extends SerializablePassData {

	private Tracker tracker;

	public Tracker getTracker() {
		return tracker;
	}

	public void setTracker(Tracker tracker) {
		this.tracker = tracker;
	}

	public RouteDetailPassData() {
		super();
	}
	
	public RouteDetailPassData(Tracker tracker) {
		this.tracker = tracker;
	}

	@Override
	public void serialize(DataOutputStream out) throws SerializationException {
		serializeSerializable(this.tracker, out);
	}

	@Override
	public void deserialize(DataInputStream in) throws SerializationException {
		this.tracker = (Tracker) deserializeSerializable(Tracker.class, in);
	}

	@Override
	public String toString() {
		StringBuilder s = new StringBuilder("{");
		
		s.append("tracker=");
		if (this.tracker == null)
			s.append("(null)");
		else
			s.append(this.tracker.toString());
		s.append("}");
		
		return s.toString();
	}

}
